<div class="role-type">

  <nz-collapseset>
    <nz-collapse [nzTitle]="panels.name" [nzActive]="panels.active" [nzDisabled]="panels.disabled">
      <form nz-form [nzLayout]="'inline'">
        <div nz-row *ngIf="partyType == 1">
          <div nz-form-item nz-col [nzSpan]="8">
            <div nz-form-label nz-col [nzSm]="6" [nzXs]="6">
              <label>请输入甲方名称</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="16">
              <nz-input [(ngModel)]="contractBean.firstPartyName" name="firstPartyName">
              </nz-input>
            </div>
          </div>
          <button nz-button  [nzType]="'primary'" (click)="query()">查询</button>
        </div>

        <div nz-row *ngIf="partyType == 2">
          <div nz-form-item nz-col [nzSpan]="8">
            <div nz-form-label nz-col [nzSm]="6" [nzXs]="6">
              <label>请输入乙方名称</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="16">
              <nz-input [(ngModel)]="contractBean.secondPartyName" name="secondPartyName">
              </nz-input>
            </div>
          </div>
          <button nz-button  [nzType]="'primary'" (click)="query()">查询</button>
         </div>
      </form>

    </nz-collapse>
  </nz-collapseset>
  <ul nz-menu [nzMode]="'horizontal'">
    <li *ngIf="partyType == 1" nz-menu-item (click)="add(title, content, footer)">
    <i class="anticon anticon-plus"></i>添加</li>
    <li  nz-menu-item (click)="update(title, content, footer)">
      <i class="anticon anticon-copy"></i>修改/详情</li>
    <li *ngIf="partyType == 1" nz-menu-item (click)="delete()">
      <i class="anticon anticon-delete"></i>删除</li>
  </ul>
  <nz-table #nzTable [nzDataSource]="list" nzSize="middle" [nzBordered]="true" [nzIsPagination]="false" (nzDataChange)="displayDataChange($event)">
    <thead nz-thead>
      <tr>
        <th nz-th [nzCheckbox]="true">
          <label nz-checkbox [(ngModel)]="allChecked" [nzIndeterminate]="indeterminate" (ngModelChange)="checkAll($event)">
          </label>
        </th>
        <th nz-th>
          <span>甲方名称</span>
        </th>
        <th nz-th>
          <span>乙方名称</span>
        </th>
        <th nz-th>
          <span>合同类型</span>
        </th>
        <th nz-th>
          <span>合同电梯数量</span>
        </th>
        <th nz-th>
          <span>负责人</span>
        </th>
       <th nz-th>
          <span>项目列表</span>
       </th>
      </tr>
    </thead>
    <tbody nz-tbody>
      <tr nz-tbody-tr *ngFor="let data of list">
        <td nz-td [nzCheckbox]="true">
          <label nz-checkbox [nzDisabled]="data.disabled" [(ngModel)]="data.checked" (ngModelChange)="refreshStatus($event)">
          </label>
        </td>
        <td nz-td>{{data.firstPartyName}}</td>
        <td nz-td>{{data.secondPartyName}}</td>
        <td nz-td>{{data.contractType}}</td>
        <td nz-td>{{data.contractNumber}}</td>
        <td nz-td>{{data.addUserName}}</td>
        <td nz-td>
          <button nz-button [nzSize]="'large'" [nzType]="'primary'" (click)="detail(data)">添加项目</button>
        </td>
      </tr>
    </tbody>
  </nz-table>
  <nz-pagination [nzPageIndex]="contractBean.currentPage" nzShowTotal [nzTotal]="total" nzShowSizeChanger
    (nzPageSizeChange)="nzPageSizeChange($event)" (nzPageIndexChange)="nzPageIndexChange($event)"
    (nzPageIndexClickChange)="nzPageIndexClickChange($event)" [nzPageSize]="contractBean.pageSize"></nz-pagination>

  <!--添加页面 -->
  <ng-template #title>
    <span>{{modelTitle}}</span>
  </ng-template>
  <ng-template #content>
    <contract-add-page *ngIf="modal==0" [inValue]="totalList" (outPut)="addOutPut($event)"></contract-add-page>
    <contract-modify-page *ngIf="modal==1" [inValue]="updateData" (outPut)="addOutPut($event)"></contract-modify-page>
  </ng-template>
  <ng-template #footer>
    <div>
    </div>
  </ng-template>

  <!--查看附件页面 -->
  <ng-template #titleFile>
    <span>{{modelTitle}}</span>
  </ng-template>
  <ng-template #contentFile>
    <enlarge-pic [inValue]="fileList" (outPut)="addOutPut($event)"></enlarge-pic>
  </ng-template>
  <ng-template #footerFile>
    <div>
    </div>
  </ng-template>
</div>
